/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package admin;

import dao.GiayDAO;
import dao.LoaiGiayDAO;
import dao.MauSacDAO;
import dao.TinhTrangGiayDAO;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import pojo.GiayPOJO;

/**
 *
 * @author NhatHuy
 */
@WebServlet(name = "QuanLyGiay", urlPatterns = {"/QuanLyGiay"})
public class QuanLyGiay extends HttpServlet {

    /** 
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            HttpSession session = request.getSession();
            //Nếu quản trị chưa đăng nhập, chuyển sang trang đăng nhập.
            if (session.getAttribute("QuanTri") == null){
                String url = request.getContextPath()+"/admin/DangNhapAdmin.html";
                response.sendRedirect(url);
                return;
            } 
            
            //Set chọn loại tìm kiếm hiện tại.
            String tuKhoa = request.getParameter("tfTimKiem");
            if (tuKhoa == null){
                tuKhoa = "";
            }
            String strloaiTimKiem = request.getParameter("slLoaiTimKiem");
            int loaiTimKiem = 0; //Lấy thông tin loại tìm kiếm
            if (strloaiTimKiem != null){
                loaiTimKiem = Integer.parseInt(strloaiTimKiem);
            }
            
            out.println ("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>");
            out.println ("<html xmlns='http://www.w3.org/1999/xhtml'>");
            out.println ("<head>");
            out.println ("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />");
            out.println ("<title>Quản lý giày</title>");
            out.println ("<link rel='stylesheet' href='admin/css/screen.css' type='text/css' media='screen' title='default' />");
            out.println ("<!--[if IE]>");
            out.println ("<link rel='stylesheet' media='all' type='text/css' href='admin/css/pro_dropline_ie.css' />");
            out.println ("<![endif]-->");
            out.println ("");
            out.println ("<!--  jquery core -->");
            out.println ("<script src='admin/js/jquery/jquery-1.4.1.min.js' type='text/javascript'></script>");
            out.println ("");
            out.println ("<!--  checkbox styling script -->");
            out.println ("<script src='admin/js/jquery/ui.core.js' type='text/javascript'></script>");
            out.println ("<script src='admin/js/jquery/ui.checkbox.js' type='text/javascript'></script>");
            out.println ("<script src='admin/js/jquery/jquery.bind.js' type='text/javascript'></script>");
            out.println ("<script type='text/javasciript'>");
            out.println ("$(function(){");
            out.println ("	$('input').checkBox();");
            out.println ("	$('#toggle-all').click(function(){");
            out.println (" 	$('#toggle-all').toggleClass('toggle-checked');");
            out.println ("	$('#mainform input[type=checkbox]').checkBox('toggle');");
            out.println ("	return false;");
            out.println ("	});");
            out.println ("});");
            out.println ("</script>  ");
            out.println ("");
            out.println ("<![if !IE 7]>");
            out.println ("");
            out.println ("<!--  styled select box script version 1 -->");
            out.println ("<script src='admin/js/jquery/jquery.selectbox-0.5.js' type='text/javascript'></script>");
            out.println ("<script type='text/javascript'>");
            out.println ("$(document).ready(function() {");
            out.println ("	$('.styledselect').selectbox({ inputClass: 'selectbox_styled' });");
            out.println ("});");
            out.println ("</script>");
            out.println (" ");
            out.println ("");
            out.println ("<![endif]>");
            out.println ("");
            out.println ("<!--  styled select box script version 2 --> ");
            out.println ("<script src='admin/js/jquery/jquery.selectbox-0.5_style_2.js' type='text/javascript'></script>");
            out.println ("<script type='text/javascript'>");
            out.println ("$(document).ready(function() {");
            out.println ("	$('.styledselect_form_1').selectbox({ inputClass: 'styledselect_form_1' });");
            out.println ("	$('.styledselect_form_2').selectbox({ inputClass: 'styledselect_form_2' });");
            out.println ("});");
            out.println ("</script>");
            out.println ("");
            out.println ("<!--  styled select box script version 3 --> ");
            out.println ("<script src='admin/js/jquery/jquery.selectbox-0.5_style_2.js' type='text/javascript'></script>");
            out.println ("<script type='text/javascript'>");
            out.println ("$(document).ready(function() {");
            out.println ("	$('.styledselect_pages').selectbox({ inputClass: 'styledselect_pages' });");
            out.println ("});");
            out.println ("</script>");
            out.println ("");
            out.println ("<!--  styled file upload script --> ");
            out.println ("<script src='admin/js/jquery/jquery.filestyle.js' type='text/javascript'></script>");
            out.println ("<script type='text/javascript' charset='utf-8'>");
            out.println ("  $(function() {");
            out.println ("      $('input.file_1').filestyle({ ");
            out.println ("          image: 'admin/images/forms/choose-file.gif',");
            out.println ("          imageheight : 21,");
            out.println ("          imagewidth : 78,");
            out.println ("          width : 310");
            out.println ("      });");
            out.println ("  });");
            out.println ("</script>");
            out.println ("");
            out.println ("<!-- Custom jquery scripts -->");
            out.println ("<script src='admin/js/jquery/custom_jquery.js' type='text/javascript'></script>");
            out.println (" ");
            out.println ("<!-- Tooltips -->");
            out.println ("<script src='admin/js/jquery/jquery.tooltip.js' type='text/javascript'></script>");
            out.println ("<script src='admin/js/jquery/jquery.dimensions.js' type='text/javascript'></script>");
            out.println ("<script type='text/javascript'>");
            out.println ("$(function() {");
            out.println ("	$('a.info-tooltip ').tooltip({");
            out.println ("		track: true,");
            out.println ("		delay: 0,");
            out.println ("		fixPNG: true, ");
            out.println ("		showURL: false,");
            out.println ("		showBody: ' - ',");
            out.println ("		top: -35,");
            out.println ("		left: 5");
            out.println ("	});");
            out.println ("});");
            out.println ("</script> ");
            out.println ("");
            out.println ("");
            out.println ("<!--  date picker script -->");
            out.println ("<link rel='stylesheet' href='admin/css/datePicker.css' type='text/css' />");
            out.println ("<script src='admin/js/jquery/date.js' type='text/javascript'></script>");
            out.println ("<script src='admin/js/jquery/jquery.datePicker.js' type='text/javascript'></script>");
            out.println ("<script type='text/javascript' charset='utf-8'>");
            out.println ("        $(function()");
            out.println ("{");
            out.println ("");
            out.println ("// initialise the 'Select date' link");
            out.println ("$('#date-pick')");
            out.println ("	.datePicker(");
            out.println ("		// associate the link with a date picker");
            out.println ("		{");
            out.println ("			createButton:false,");
            out.println ("			startDate:'01/01/2005',");
            out.println ("			endDate:'31/12/2020'");
            out.println ("		}");
            out.println ("	).bind(");
            out.println ("		// when the link is clicked display the date picker");
            out.println ("		'click',");
            out.println ("		function()");
            out.println ("		{");
            out.println ("			updateSelects($(this).dpGetSelected()[0]);");
            out.println ("			$(this).dpDisplay();");
            out.println ("			return false;");
            out.println ("		}");
            out.println ("	).bind(");
            out.println ("		// when a date is selected update the SELECTs");
            out.println ("		'dateSelected',");
            out.println ("		function(e, selectedDate, $td, state)");
            out.println ("		{");
            out.println ("			updateSelects(selectedDate);");
            out.println ("		}");
            out.println ("	).bind(");
            out.println ("		'dpClosed',");
            out.println ("		function(e, selected)");
            out.println ("		{");
            out.println ("			updateSelects(selected[0]);");
            out.println ("		}");
            out.println ("	);");
            out.println ("	");
            out.println ("var updateSelects = function (selectedDate)");
            out.println ("{");
            out.println ("	var selectedDate = new Date(selectedDate);");
            out.println ("	$('#d option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');");
            out.println ("	$('#m option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');");
            out.println ("	$('#y option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');");
            out.println ("}");
            out.println ("// listen for when the selects are changed and update the picker");
            out.println ("$('#d, #m, #y')");
            out.println ("	.bind(");
            out.println ("		'change',");
            out.println ("		function()");
            out.println ("		{");
            out.println ("			var d = new Date(");
            out.println ("						$('#y').val(),");
            out.println ("						$('#m').val()-1,");
            out.println ("						$('#d').val()");
            out.println ("					);");
            out.println ("			$('#date-pick').dpSetSelected(d.asString());");
            out.println ("		}");
            out.println ("	);");
            out.println ("");
            out.println ("// default the position of the selects to today");
            out.println ("var today = new Date();");
            out.println ("updateSelects(today.getTime());");
            out.println ("");
            out.println ("// and update the datePicker to reflect it...");
            out.println ("$('#d').trigger('change');");
            out.println ("});");
            out.println ("</script>");
            out.println ("");
            out.println ("<!-- MUST BE THE LAST SCRIPT IN <HEAD></HEAD></HEAD> png fix -->");
            out.println ("<script src='admin/js/jquery/jquery.pngFix.pack.js' type='text/javascript'></script>");
            out.println ("<script type='text/javascript'>");
            out.println ("$(document).ready(function(){");
            out.println ("$(document).pngFix( );");
            out.println ("});");
            out.println ("</script>");
            out.println ("</head>");
            out.println ("<body> ");
            out.println ("<!-- Start: page-top-outer -->");
            out.println ("<div id='page-top-outer'>    ");
            out.println ("");
            out.println ("<!-- Start: page-top -->");
            out.println ("<div id='page-top'>");
            out.println ("");
            out.println ("	<!-- start logo -->");
            out.println ("	<div id='logo'>");
            out.println ("	<a href=''><img src='admin/images/shared/logo.png' width='156' height='40' alt='' /></a>");
            out.println ("	</div>");
            out.println ("	<!-- end logo -->");
            out.println ("	");
            
            //Bắt đầu form tìm kiếm.
            out.println ("<form name='frmTimKiem' method='get' action='TimKiemGiay'>");
            out.println ("	<!--  start top-search -->");
            out.println ("	<div id='top-search'>");
            out.println ("		<table border='0' cellpadding='0' cellspacing='0'>");
            out.println ("		<tr>");
            
            out.println ("		<td><input type='text' name='tfTimKiem' value='"+tuKhoa+"' onblur='if (this.value=='') { this.value='Search'; }' onfocus='if (this.value=='Search') { this.value=''; }' class='top-search-inp' /></td>");
            
            out.println ("		<td>");
            out.println ("		<select name='slLoaiTimKiem' class='styledselect'>");
            
            //Set chọn loại tìm kiếm hiện tại.
            switch (loaiTimKiem){
                case 0:                     
                    out.println ("<option value='0' SELECTED>Tên giày</option>");
                    out.println ("<option value='1'>Màu sắc</option>");
//                    out.println ("<option value='2'>Giới tính</option>");
                    break;
                case 1:
                    out.println ("<option value='0'>Tên giày</option>");
                    out.println ("<option value='1' SELECTED>Màu sắc</option>");
//                    out.println ("<option value='2'>Giới tính</option>");
                    break;
                case 2:
                    out.println ("<option value='0'>Tên giày</option>");
                    out.println ("<option value='1'>Màu sắc</option>");
//                    out.println ("<option value='2' SELECTED>Giới tính</option>");
                    break;
            }
            //Kết thúc Set chọn loại tìm kiếm hiện tại.
            
            out.println ("		</select> ");
            out.println ("		</td>");
            out.println ("		<td>");
            out.println ("		<input type='submit' value='' class='form-search' src='admin/images/shared/top_search_btn.gif'  />");
            out.println ("		</td>");
            out.println ("		</tr>");
            out.println ("		</table>");
            out.println ("	</div>");
            out.println (" 	<!--  end top-search -->");
            out.println ("</form>");
            //Kết thúc form tìm kiếm.
            
            
            out.println (" 	<div class='clear'></div>");
            out.println ("");
            out.println ("</div>");
            out.println ("<!-- End: page-top -->");
            out.println ("");
            out.println ("</div>");
            out.println ("<!-- End: page-top-outer -->");
            out.println ("	");
            out.println ("<div class='clear'>&nbsp;</div>");
            out.println (" ");
            out.println ("<!--  start nav-outer-repeat................................................................................................. START -->");
            out.println ("<div class='nav-outer-repeat'> ");
            out.println ("<!--  start nav-outer -->");
            out.println ("<div class='nav-outer'> ");
            out.println ("");
            out.println ("		<!-- start nav-right -->");
            out.println ("		<div id='nav-right'>");
            out.println ("		");
            out.println ("			<div class='nav-divider'>&nbsp;</div>");
            out.println ("			<div class='showhide-account'><img src='admin/images/shared/nav/nav_myaccount.gif' width='93' height='14' alt='' /></div>");
            out.println ("			<div class='nav-divider'>&nbsp;</div>");
            out.println ("			<a href='XuLyDangXuatAdmin' id='logout'><img src='admin/images/shared/nav/nav_logout.gif' width='64' height='14' alt='' /></a>");
            out.println ("			<div class='clear'>&nbsp;</div>");
            out.println ("		");
            out.println ("			<!--  start account-content -->	");
            out.println ("			<div class='account-content'>");
            out.println ("			<div class='account-drop-inner'>");
            out.println ("				<a href='' id='acc-settings'>Settings</a>");
            out.println ("				<div class='clear'>&nbsp;</div>");
            out.println ("				<div class='acc-line'>&nbsp;</div>");
            out.println ("				<a href='' id='acc-details'>Personal details </a>");
            out.println ("				<div class='clear'>&nbsp;</div>");
            out.println ("				<div class='acc-line'>&nbsp;</div>");
            out.println ("				<a href='' id='acc-project'>Project details</a>");
            out.println ("				<div class='clear'>&nbsp;</div>");
            out.println ("				<div class='acc-line'>&nbsp;</div>");
            out.println ("				<a href='' id='acc-inbox'>Inbox</a>");
            out.println ("				<div class='clear'>&nbsp;</div>");
            out.println ("				<div class='acc-line'>&nbsp;</div>");
            out.println ("				<a href='' id='acc-stats'>Statistics</a> ");
            out.println ("			</div>");
            out.println ("			</div>");
            out.println ("			<!--  end account-content -->");
            out.println ("		");
            out.println ("		</div>");
            out.println ("		<!-- end nav-right -->");
            out.println ("");
            out.println ("");
            out.println ("		<!--  start nav -->");
            out.println ("		<div class='nav'>");
            out.println ("		<div class='table'>");
            out.println ("		");
            out.println ("		<ul class='select'><li><a href='#nogo'><b>Dashboard</b><!--[if IE 7]><!--></a><!--<![endif]-->");
            out.println ("		<!--[if lte IE 6]><table><tr><td><![endif]-->");
            out.println ("		<div class='select_sub'>");
            out.println ("			<ul class='sub'>");
            out.println ("				<li><a href='#nogo'>Dashboard Details 1</a></li>");
            out.println ("				<li><a href='#nogo'>Dashboard Details 2</a></li>");
            out.println ("				<li><a href='#nogo'>Dashboard Details 3</a></li>");
            out.println ("			</ul>");
            out.println ("		</div>");
            out.println ("		<!--[if lte IE 6]></td></tr></table></a><![endif]-->");
            out.println ("		</li>");
            out.println ("		</ul>");
            out.println ("		");
            out.println ("		<div class='nav-divider'>&nbsp;</div>");
            out.println ("		                    ");
            out.println ("		<ul class='current'><li><a href='#nogo'><b>Products</b><!--[if IE 7]><!--></a><!--<![endif]-->");
            out.println ("		<!--[if lte IE 6]><table><tr><td><![endif]-->");
            out.println ("		<div class='select_sub show'>");
            out.println ("			<ul class='sub'>");
            out.println ("				<li><a href='"+request.getContextPath()+"/QuanLyGiay'>Xem tất cả các sản phẩm</a></li>");
            out.println ("				<li class='sub_show'><a href='"+request.getContextPath()+"/ThemGiay'>Thêm giày</a></li>");
            out.println ("				<li><a href='#nogo'>Delete products</a></li>");
            out.println ("			</ul>");
            out.println ("		</div>");
            out.println ("		<!--[if lte IE 6]></td></tr></table></a><![endif]-->");
            out.println ("		</li>");
            out.println ("		</ul>");
            out.println ("		");
            out.println ("		<div class='nav-divider'>&nbsp;</div>");
            out.println ("		");
            out.println ("		<ul class='select'><li><a href='#nogo'><b>Categories</b><!--[if IE 7]><!--></a><!--<![endif]-->");
            out.println ("		<!--[if lte IE 6]><table><tr><td><![endif]-->");
            out.println ("		<div class='select_sub'>");
            out.println ("			<ul class='sub'>");
            out.println ("				<li><a href='#nogo'>Categories Details 1</a></li>");
            out.println ("				<li><a href='#nogo'>Categories Details 2</a></li>");
            out.println ("				<li><a href='#nogo'>Categories Details 3</a></li>");
            out.println ("			</ul>");
            out.println ("		</div>");
            out.println ("		<!--[if lte IE 6]></td></tr></table></a><![endif]-->");
            out.println ("		</li>");
            out.println ("		</ul>");
            out.println ("		");
            out.println ("		<div class='nav-divider'>&nbsp;</div>");
            out.println ("		");
            out.println ("		<ul class='select'><li><a href='#nogo'><b>Clients</b><!--[if IE 7]><!--></a><!--<![endif]-->");
            out.println ("		<!--[if lte IE 6]><table><tr><td><![endif]-->");
            out.println ("		<div class='select_sub'>");
            out.println ("			<ul class='sub'>");
            out.println ("				<li><a href='#nogo'>Clients Details 1</a></li>");
            out.println ("				<li><a href='#nogo'>Clients Details 2</a></li>");
            out.println ("				<li><a href='#nogo'>Clients Details 3</a></li>");
            out.println ("			 ");
            out.println ("			</ul>");
            out.println ("		</div>");
            out.println ("		<!--[if lte IE 6]></td></tr></table></a><![endif]-->");
            out.println ("		</li>");
            out.println ("		</ul>");
            out.println ("		");
            out.println ("		<div class='nav-divider'>&nbsp;</div>");
            out.println ("		");
            out.println ("		<ul class='select'><li><a href='#nogo'><b>News</b><!--[if IE 7]><!--></a><!--<![endif]-->");
            out.println ("		<!--[if lte IE 6]><table><tr><td><![endif]-->");
            out.println ("		<div class='select_sub'>");
            out.println ("			<ul class='sub'>");
            out.println ("				<li><a href='#nogo'>News details 1</a></li>");
            out.println ("				<li><a href='#nogo'>News details 2</a></li>");
            out.println ("				<li><a href='#nogo'>News details 3</a></li>");
            out.println ("			</ul>");
            out.println ("		</div>");
            out.println ("		<!--[if lte IE 6]></td></tr></table></a><![endif]-->");
            out.println ("		</li>");
            out.println ("		</ul>");
            out.println ("		");
            out.println ("		<div class='clear'></div>");
            out.println ("		</div>");
            out.println ("		<div class='clear'></div>");
            out.println ("		</div>");
            out.println ("		<!--  start nav -->");
            out.println ("");
            out.println ("</div>");
            out.println ("<div class='clear'></div>");
            out.println ("<!--  start nav-outer -->");
            out.println ("</div>");
            out.println ("<!--  start nav-outer-repeat................................................... END -->");
            out.println ("");
            out.println (" <div class='clear'></div>");
            out.println (" ");
            out.println ("<!-- start content-outer ........................................................................................................................START -->");
            out.println ("<div id='content-outer'>");
            out.println ("<!-- start content -->");
            out.println ("<div id='content'>");
            out.println ("");
            out.println ("	<!--  start page-heading -->");
            out.println ("	<div id='page-heading'>");
            out.println ("		<h1>Thêm giày</h1>");
            out.println ("	</div>");
            out.println ("	<!-- end page-heading -->");
            out.println ("");
            out.println ("	<table border='0' width='100%' cellpadding='0' cellspacing='0' id='content-table'>");
            out.println ("	<tr>");
            out.println ("		<th rowspan='3' class='sized'><img src='admin/images/shared/side_shadowleft.jpg' width='20' height='300' alt='' /></th>");
            out.println ("		<th class='topleft'></th>");
            out.println ("		<td id='tbl-border-top'>&nbsp;</td>");
            out.println ("		<th class='topright'></th>");
            out.println ("		<th rowspan='3' class='sized'><img src='admin/images/shared/side_shadowright.jpg' width='20' height='300' alt='' /></th>");
            out.println ("	</tr>");
            out.println ("	<tr>");
            out.println ("		<td id='tbl-border-left'></td>");
            out.println ("		<td>");
            out.println ("		<!--  start content-table-inner ...................................................................... START -->");
            out.println ("		<div id='content-table-inner'>");
            out.println ("		");
            out.println ("			<!--  start table-content  -->");
            out.println ("			<div id='table-content'>");
//            out.println ("			");
//            out.println ("				<!--  start message-yellow -->");
//            out.println ("				<div id='message-yellow'>");
//            out.println ("				<table border='0' width='100%' cellpadding='0' cellspacing='0'>");
//            out.println ("				<tr>");
//            out.println ("					<td class='yellow-left'>You have a new message. <a href=''>Go to Inbox.</a></td>");
//            out.println ("					<td class='yellow-right'><a class='close-yellow'><img src='admin/images/table/icon_close_yellow.gif'   alt='' /></a></td>");
//            out.println ("				</tr>");
//            out.println ("				</table>");
//            out.println ("				</div>");
//            out.println ("				<!--  end message-yellow -->");
//            out.println ("				");
//            out.println ("				<!--  start message-red -->");
//            out.println ("				<div id='message-red'>");
//            out.println ("				<table border='0' width='100%' cellpadding='0' cellspacing='0'>");
//            out.println ("				<tr>");
//            out.println ("					<td class='red-left'>Error. <a href=''>Please try again.</a></td>");
//            out.println ("					<td class='red-right'><a class='close-red'><img src='admin/images/table/icon_close_red.gif'   alt='' /></a></td>");
//            out.println ("				</tr>");
//            out.println ("				</table>");
//            out.println ("				</div>");
//            out.println ("				<!--  end message-red -->");
//            out.println ("				");
//            out.println ("				<!--  start message-blue -->");
//            out.println ("				<div id='message-blue'>");
//            out.println ("				<table border='0' width='100%' cellpadding='0' cellspacing='0'>");
//            out.println ("				<tr>");
//            out.println ("					<td class='blue-left'>Welcome back. <a href=''>View my account.</a> </td>");
//            out.println ("					<td class='blue-right'><a class='close-blue'><img src='admin/images/table/icon_close_blue.gif'   alt='' /></a></td>");
//            out.println ("				</tr>");
//            out.println ("				</table>");
//            out.println ("				</div>");
//            out.println ("				<!--  end message-blue -->");
//            out.println ("			");
            out.println ("				<!--  start message-green -->");
            out.println ("				<div id='message-green'>");
            out.println ("				<table border='0' width='100%' cellpadding='0' cellspacing='0'>");
            out.println ("				<tr>");
            out.println ("					<td class='green-left'><a href='"+request.getContextPath()+"/ThemGiay'><strong>Thêm giày.</strong></a></td>");
            out.println ("					<td class='green-right'><a class='close-green'><img src='admin/images/table/icon_close_green.gif'   alt='' /></a></td>");
            out.println ("				</tr>");
            out.println ("				</table>");
            out.println ("				</div>");
            out.println ("				<!--  end message-green -->");
            out.println ("		");
            out.println ("		 ");
            out.println ("				<!--  start product-table ..................................................................................... -->");
            out.println ("				<form id='mainform' action='XuLyXoaNhieuGiay'>");
            out.println ("				<table border='0' width='100%' cellpadding='0' cellspacing='0' id='product-table'>");
            out.println ("				<tr>");
            out.println ("					<th class='table-header-check'><a id='toggle-all' ></a> </th>");
            out.println ("					<th class='table-header-repeat line-left minwidth-1'><a href=''>Tên giày</a>	</th>");
            out.println ("					<th class='table-header-repeat line-left minwidth-1'><a href=''>Màu sắc</a></th>");
            out.println ("					<th class='table-header-repeat line-left'><a href=''>Giới tính</a></th>");
            out.println ("					<th class='table-header-repeat line-left'><a href=''>Tình trạng</a></th>");
            out.println ("					<th class='table-header-repeat line-left'><a href=''>Loại giày</a></th>");
            out.println ("                                      <th class='table-header-repeat line-left'><a href=''>Giá bán</a></th>");
            out.println ("					<th class='table-header-repeat line-left'><a href=''>Số lượng</a></th>");
            out.println ("					<th class='table-header-options line-left'><a href=''>Thao tác</a></th>");
            out.println ("				</tr>");
            
            //Bắt đầu danh mục giày có phân trang.
            int trang = 1;
            if (request.getParameter("Trang")!=null){
                trang = Integer.parseInt(request.getParameter("Trang"));
            }
            ArrayList<GiayPOJO> dmGiay = GiayDAO.layDanhMucGiayCoPhanTrangAdmin(trang);
            out.println("Số lượng giày: "+dmGiay.size());
            for (int i=0; i<dmGiay.size(); i++){
                GiayPOJO giay = dmGiay.get(i);
                String tenMauSac = MauSacDAO.timTenMauSacTheoMa(giay.getMaMauSac());
                String tenTinhTrang = TinhTrangGiayDAO.timTenTinhTrangTheoMa(giay.getMaTinhTrang());
                String tenLoaiGiay = LoaiGiayDAO.timTenLoaiGiayTheoMa(giay.getMaLoaiGiay());
                String gioiTinh = "Nam";
                if (giay.getGioiTinh() == 0){
                    gioiTinh = "Nữ";
                }
                if (i%2 == 0){ //Hiệu ứng màu sọc ngang.
                    out.println ("<tr class='alternate-row'>");
                }else{
                    out.println ("<tr>");
                }                
                out.println ("<td><input name='"+giay.getMaGiay()+"' type='checkbox'/></td>");
                out.println ("<td>"+giay.getTenGiay()+"</td>");
                out.println ("<td>"+tenMauSac+"</td>");
                out.println ("<td><a href=''>"+gioiTinh+"</a></td>");
                out.println ("<td>"+tenTinhTrang+"</td>");
                out.println ("<td><a href=''>"+tenLoaiGiay+"</a></td>");
                out.println ("<td><a href=''>"+giay.getGiaBan()+"VNĐ</a></td>");
                out.println ("<td><a href=''>"+giay.getSoLuong()+"</a></td>");
                out.println ("<td class='options-width'>");
                out.println ("<a href='CapNhatThongTinGiay?MaGiay="+giay.getMaGiay()+"&Trang="+trang+"' title='Cập nhật thông tin giày' class='icon-1 info-tooltip'></a>");
                out.println ("<a href='XuLyCapNhatTinhTrangGiayDaXoa?MaGiay="+giay.getMaGiay()+"&Trang="+trang+"' title='Cập nhật tình trạng là đã xóa' class='icon-2 info-tooltip'></a>");      
                out.println ("<a href='XuLyCapNhatTinhTrangGiayMoi?MaGiay="+giay.getMaGiay()+"&Trang="+trang+"' title='Cập nhật tình trạng là hàng mới' class='icon-3 info-tooltip'></a>");
//                out.println ("					<a href='' title='Edit' class='icon-4 info-tooltip'></a>");
                out.println ("<a href='XuLyCapNhatTinhTrangGiayBinhThuong?MaGiay="+giay.getMaGiay()+"&Trang="+trang+"' title='Cập nhật tình trạng là bình thường' class='icon-5 info-tooltip'></a>");
                out.println ("</td>");
                out.println ("</tr>");
            }
            //Kết thúc hiển thị danh mục giày có phân trang.
            
            out.println ("				</table>");
            out.println ("				<!--  end product-table................................... --> ");
            out.println ("				</form>");
            out.println ("			</div>");
            out.println ("			<!--  end content-table  -->");
            out.println ("		");
            out.println ("			<!--  start actions-box ............................................... -->");
            out.println ("			<div id='actions-box'>");
            out.println ("				<a href='' class='action-slider'></a>");
            out.println ("				<div id='actions-box-slider'>");
            out.println ("					<a href='' class='action-edit'>Edit</a>");
            out.println ("					<a href='' class='action-delete'>Delete</a>");
            out.println ("				</div>");
            out.println ("				<div class='clear'></div>");
            out.println ("			</div>");
            out.println ("			<!-- end actions-box........... -->");
            out.println ("			");
            out.println ("			<!--  start paging..................................................... -->");
            
            //Bắt đầu phân trang
            int soTrang = GiayDAO.tinhSoLuongTrangTrenTrangQuanTri();
//            out.println("Mã loại giày: "+maLoaiGiay);
//            out.println("Số trang: "+soTrang);
            out.println ("			<table border='0' cellpadding='0' cellspacing='0' id='paging-table'>");
            out.println ("			<tr>");
            out.println ("			<td>");
            for (int i=1; i<=soTrang; i++){                
                out.println ("<A href='QuanLyGiay?Trang="+i+"'>"+i+"</A>");
            }
//            out.println ("				<a href='' class='page-far-left'></a>");
//            out.println ("				<a href='' class='page-left'></a>");
//            out.println ("				<div id='page-info'>Page <strong>"+trang+"</strong> / "+soTrang+"</div>");
//            out.println ("				<a href='' class='page-right'></a>");
//            out.println ("				<a href='' class='page-far-right'></a>");
            out.println ("			</td>");
//            out.println ("			<td>");
//            out.println ("			<select  class='styledselect_pages'>");
//            out.println ("				<option value=''>Number of rows</option>");
//            out.println ("				<option value=''>1</option>");
//            out.println ("				<option value=''>2</option>");
//            out.println ("				<option value=''>3</option>");
//            out.println ("			</select>");
//            out.println ("			</td>");
            out.println ("			</tr>");
            out.println ("			</table>");
            out.println ("			<!--  end paging................ -->");
            //Kết thúc phân trang
            
            out.println ("			");
            out.println ("			<div class='clear'></div>");
            out.println ("		 ");
            out.println ("		</div>");
            out.println ("		<!--  end content-table-inner ............................................END  -->");
            out.println ("		</td>");
            out.println ("		<td id='tbl-border-right'></td>");
            out.println ("	</tr>");
            out.println ("	<tr>");
            out.println ("		<th class='sized bottomleft'></th>");
            out.println ("		<td id='tbl-border-bottom'>&nbsp;</td>");
            out.println ("		<th class='sized bottomright'></th>");
            out.println ("	</tr>");
            out.println ("	</table>");
            out.println ("	<div class='clear'>&nbsp;</div>");
            out.println ("");
            out.println ("</div>");
            out.println ("<!--  end content -->");
            out.println ("<div class='clear'>&nbsp;</div>");
            out.println ("</div>");
            out.println ("<!--  end content-outer........................................................END -->");
            out.println ("");
            out.println ("<div class='clear'>&nbsp;</div>");
            out.println ("    ");
            out.println ("<!-- start footer -->         ");
            out.println ("<div id='footer'>");
            out.println ("	<!--  start footer-left -->");
            out.println ("	<div id='footer-left'>");
            out.println ("	");
            out.println ("	Admin Skin &copy; Copyright Internet Dreams Ltd. <span id='spanYear'></span> <a href=''>www.netdreams.co.uk</a>. All rights reserved.</div>");
            out.println ("	<!--  end footer-left -->");
            out.println ("	<div class='clear'>&nbsp;</div>");
            out.println ("</div>");
            out.println ("<!-- end footer -->");
            out.println (" ");
            out.println ("</body>");
            out.println ("</html>");

        } finally {            
            out.close();
        }
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /** 
     * Handles the HTTP <code>GET</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /** 
     * Handles the HTTP <code>POST</code> method.
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /** 
     * Returns a short description of the servlet.
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>
}
